package workspace;

public class test51 {

    static class ListNode{
        ListNode next;
        int val;
        public ListNode(){
        }
    }

    public static void main(String[] args) {

    }

    public ListNode rev(ListNode node){
        ListNode pre = null;
        ListNode cur = node;
        while(cur!=null){
            ListNode next = cur.next;
            cur.next = pre;
            pre = cur;
            cur = next;
        }
        return pre;

    }

}
